<template>
  <svg aria-hidden="true" :style="Style">
    <use :xlink:href="symbolId" :fill="color" />
  </svg>
</template>

<script>
  import { defineComponent, computed } from 'vue';

  export default defineComponent({
    name: 'WxIcon',
    props: {
      prefix: {
        type: String,
        default: 'icon',
      },
      name: {
        type: String,
        required: true,
      },
      color: {
        type: String,
        default: '#333',
      },
      size: {
        type:String,
        default: () => {
          return '16px'
        }
      }
    },
    setup(props) {
      const symbolId = computed(() => `#${props.prefix}-${props.name}`);
      const Style = computed(() => {
        return {
          width:props.size,
          height:props.size
        }
      })
      return { symbolId,Style };
    },
  });
</script>
